﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MS.InformationManagement.Core.Support;
using MS.InformationManagement.DAL.DocumentCenter;
using Microsoft.SharePoint;

namespace MS.InformationManagement.BLL.ReceivedDocuments
{
    public class LoadWindowReceivedDocumentsCommnad : IBaseCommand
    {

        #region Fields

        IList<int> _selectecItems;
        IEnumerable<DocumentoImpreso> _printedDocuments;

        #endregion

        #region Constructors

        public LoadWindowReceivedDocumentsCommnad(IList<int> selectedItems)
        {
            _selectecItems = selectedItems;
        }

        #endregion

        public void Execute()
        {
            using (var dc = new DCDocumentCenterDataContext(SPContext.Current.Web.Url))
            {
                _printedDocuments = Support.GetPrintedEntities(dc, _selectecItems);
                dc.DocumentsRecibidosVentanilla.InsertAllOnSubmit(_printedDocuments);
                dc.SubmitChanges();
            }
        }

        public void Undo()
        {
            //TODO:Delete created items in window received list
        }
    }
}
